QUANTENNA_DRIVERS_SITE=repo://vendor/quantenna/drivers
QUANTENNA_DRIVERS_DEPENDENCIES=linux zlib

QUANTENNA_DRIVERS_MAKE_ENV = \
	$(TARGET_MAKE_ENV) \
	LINUX_DIR="$(LINUX_DIR)" \
	TARGET_DIR="$(TARGET_DIR)" \
	TARGET_CC="$(TARGET_CC)" \
	TARGET_CFLAGS="$(TARGET_CFLAGS)" \
	TARGET_STRIP="$(TARGET_STRIP)" \

ifeq ($(BR2_PACKAGE_QUANTENNA_DRIVERS_PCIE_HOST),y)
	QUANTENNA_DRIVERS_TARGET = pcie_host
else ifeq ($(BR2_PACKAGE_QUANTENNA_DRIVERS_PCIE_MODULE),y)
	QUANTENNA_DRIVERS_TARGET = pcie_module
else ifeq ($(BR2_PACKAGE_QUANTENNA_DRIVERS_STANDALONE),y)
	QUANTENNA_DRIVERS_TARGET = standalone
endif

define QUANTENNA_DRIVERS_BUILD_CMDS
	$(QUANTENNA_DRIVERS_MAKE_ENV) $(MAKE) -C $(@D) $(QUANTENNA_DRIVERS_TARGET)
endef

# We need to re-run modules_install for depmod to discover the
# binary kernel modules that we just installed
define QUANTENNA_DRIVERS_INSTALL_TARGET_CMDS
	$(QUANTENNA_DRIVERS_MAKE_ENV) $(MAKE) -C $(@D) $(QUANTENNA_DRIVERS_TARGET)_install

	$(TARGET_MAKE_ENV) $(MAKE1) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR)		\
		DEPMOD="$(HOST_DIR)/usr/sbin/depmod" modules_install ;		\
	rm -f $(TARGET_DIR)/lib/modules/$(LINUX_VERSION_PROBED)/build ;		\
	rm -f $(TARGET_DIR)/lib/modules/$(LINUX_VERSION_PROBED)/source
endef

ifeq ($(BR2_PACKAGE_QUANTENNA_DRIVERS),y)
LINUX_KBUILD_EXTRA_SYMBOLS = $(QUANTENNA_DRIVERS_DIR)/binary_kos.symvers/$(QUANTENNA_DRIVERS_TARGET)/$(LINUX_VERSION_PROBED)/Module.symvers
endif

$(eval $(call GENTARGETS))
